
<!DOCTYPE html>
<html lang="">


<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
  <meta name="theme-color" content="#202020">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>
  
  
    <meta name="keywords" content>
  

  
    <meta name="description" content="51AIOps 专注于运维自动化  微信： kaipython,null">
  
  
  
  <link rel="icon" type="image/x-icon" href="/images/footer-logo.png">
  
  <title> [ 51AIOps 专注于运维自动化  微信： kaipython ]</title>
  
    <!-- stylesheets list from config.yml -->
    
      <link rel="stylesheet" href="//cdn.bootcss.com/pure/1.0.0/pure-min.css">
    
      <link rel="stylesheet" href="/css/xoxo.css">
    
  
</head>


<body>
  <div class="nav-container">
    <nav class="home-menu pure-menu pure-menu-horizontal">
  <a class="pure-menu-heading" href="/">
    
    <span class="title" style="text-transform:none">51AIOps 专注于运维自动化  微信： kaipython</span>
  </a>

  <ul class="pure-menu-list clearfix">
      
          
            
              <li class="pure-menu-item"><a href="/" class="pure-menu-link">首页</a></li>
            
          
      
  </ul>
   
</nav>

  </div>

  <div class="container" id="content-outer">
    <div class="inner" id="content-inner" style='margin-left:-68px!important'>
      <div class="post-container">
  <article class="post" id="post">
    <header class="post-header text-center">
      <h1 class="title">
        
      </h1>
      <span>
        
        <time class="time" datetime="2020-11-23T12:40:55.979Z">
        2020-11-23
      </time>
        
      </span>
      <span class="slash">/</span>
      <span class="post-meta">
      <span class="post-tags">
        
      </span>
    </span>
      <span class="slash">/</span>
      <span class="read">
      <span id="busuanzi_value_page_pv"></span> 点击
    </span>
      <span class="slash">/</span>
    </header>

    <div class="post-content">
      <p>项目管理模块：</p>
<p>后端逻辑：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> django.shortcuts <span class="keyword">import</span> render</span><br><span class="line"><span class="keyword">from</span> utils.gitlab_api <span class="keyword">import</span> get_user_projects</span><br><span class="line"><span class="comment"># Create your views here.</span></span><br><span class="line"><span class="keyword">from</span> django.views <span class="keyword">import</span> View</span><br><span class="line"><span class="keyword">from</span> apps.common <span class="keyword">import</span> response</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">GetProjectInfo</span><span class="params">(View)</span>:</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get</span><span class="params">(self, request)</span>:</span></span><br><span class="line"></span><br><span class="line">        projects = get_user_projects(request)</span><br><span class="line">        ret = []</span><br><span class="line">        <span class="keyword">for</span> obj <span class="keyword">in</span> projects:</span><br><span class="line">            info = &#123;&#125;</span><br><span class="line">            info[<span class="string">'id'</span>] = obj.id</span><br><span class="line">            info[<span class="string">'name'</span>] = obj.name</span><br><span class="line">            info[<span class="string">'description'</span>] = obj.description</span><br><span class="line">            info[<span class="string">'web_url'</span>] = obj.web_url</span><br><span class="line">            ret.append(info)</span><br><span class="line">        print(ret)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> response.HttpOKResponse(ret)</span><br></pre></td></tr></table></figure>

<p>前端页面：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">  &lt;div&gt;</span><br><span class="line">    &lt;Table border :columns=&quot;columns12&quot; :data=&quot;projects&quot; &gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;web_url&quot;&gt;</span><br><span class="line">        &lt;a&gt;&#123;&#123; row.web_url &#125;&#125;&lt;/a&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row, index &#125;&quot; slot=&quot;action&quot;&gt;</span><br><span class="line">        &lt;!--        &lt;Button type=&quot;primary&quot; size=&quot;small&quot; style=&quot;margin-right: 5px&quot; @click=&quot;show(index)&quot;&gt;处理&lt;/Button&gt;--&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">    &lt;/Table&gt;</span><br><span class="line"></span><br><span class="line">    &lt;div style=&quot;margin-top: 10px&quot;&gt;</span><br><span class="line">      &lt;template&gt;</span><br><span class="line">        &lt;Page :total=&quot;total&quot;   @on-change=&quot;changepage&quot; /&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">    import &#123; getProjectList &#125; from &apos;@/api/project/project&apos;</span><br><span class="line">    export default &#123;</span><br><span class="line">        name: &quot;project_list&quot;,</span><br><span class="line">        data() &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                columns12: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;ID&apos;,</span><br><span class="line">                        key: &apos;id&apos;</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;项目名称&apos;,</span><br><span class="line">                        key: &apos;name&apos;</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;项目描述&apos;,</span><br><span class="line">                        key: &apos;description&apos;,</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;项目地址&apos;,</span><br><span class="line">                        slot: &apos;web_url&apos;,</span><br><span class="line">                    &#125;,</span><br><span class="line"></span><br><span class="line">                ],</span><br><span class="line">                projects: [],</span><br><span class="line">                params:&#123;</span><br><span class="line">                    page:1,</span><br><span class="line">                    page_size:10,</span><br><span class="line">                    status:1</span><br><span class="line">                &#125;,</span><br><span class="line">                total:0,</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line"></span><br><span class="line">        created() &#123;</span><br><span class="line">            this.fetchData()</span><br><span class="line">        &#125;,</span><br><span class="line"></span><br><span class="line">        methods: &#123;</span><br><span class="line">            fetchData() &#123;</span><br><span class="line">                getProjectList().then(res =&gt; &#123;</span><br><span class="line">                    this.projects = res.data.data</span><br><span class="line">                    console.log(this.projects)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            changepage (index) &#123;</span><br><span class="line">                console.log(index)</span><br><span class="line">                this.params[&apos;page&apos;] = index</span><br><span class="line">                this.fetchData(this.params)</span><br><span class="line">            &#125;,</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>

<p>工单模块：</p>
<p>模型表：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> django.db <span class="keyword">import</span> models</span><br><span class="line"></span><br><span class="line"><span class="comment"># Create your models here.</span></span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">WorkOrder</span><span class="params">(models.Model)</span>:</span></span><br><span class="line">    work_type = (</span><br><span class="line">        (<span class="number">0</span>, <span class="string">'数据库'</span>),</span><br><span class="line">        (<span class="number">1</span>, <span class="string">'WEB服务'</span>),</span><br><span class="line">        (<span class="number">2</span>, <span class="string">'计划任务'</span>),</span><br><span class="line">        (<span class="number">3</span>, <span class="string">'配置文件'</span>),</span><br><span class="line">        (<span class="number">4</span>, <span class="string">'其他'</span>)</span><br><span class="line">    )</span><br><span class="line">    status_type = (</span><br><span class="line"></span><br><span class="line">        (<span class="number">1</span>, <span class="string">'待处理'</span>),</span><br><span class="line">        (<span class="number">2</span>, <span class="string">'完成'</span>),</span><br><span class="line">        (<span class="number">3</span>, <span class="string">'驳回'</span>),</span><br><span class="line">        (<span class="number">4</span>, <span class="string">'取消'</span>),</span><br><span class="line">    )</span><br><span class="line"></span><br><span class="line">    title = models.CharField(max_length=<span class="number">32</span>, verbose_name=<span class="string">'工单标题'</span>)</span><br><span class="line">    type = models.IntegerField(choices=work_type, default=<span class="number">1</span>, verbose_name=<span class="string">'工单类型'</span>)</span><br><span class="line">    order_contents = models.TextField(verbose_name=<span class="string">'工单内容'</span>)</span><br><span class="line">    applicant = models.CharField(max_length=<span class="number">32</span>, verbose_name=<span class="string">'申请人'</span>)</span><br><span class="line">    assign_to = models.CharField(max_length=<span class="number">32</span>, verbose_name=<span class="string">'指派给'</span>)</span><br><span class="line">    final_processor = models.CharField(max_length=<span class="number">32</span>,verbose_name=<span class="string">'最终处理人'</span>)</span><br><span class="line">    status = models.IntegerField(choices=status_type,default=<span class="number">0</span>, verbose_name=<span class="string">'工单状态'</span>)</span><br><span class="line">    result_desc = models.TextField(verbose_name=<span class="string">'处理结果'</span>, blank=<span class="literal">True</span>, null=<span class="literal">True</span>)</span><br><span class="line">    apply_time = models.DateTimeField(auto_now_add=<span class="literal">True</span>, verbose_name=<span class="string">'申请时间'</span>)</span><br><span class="line">    complete_time = models.DateTimeField(auto_now=<span class="literal">True</span>, verbose_name=<span class="string">'处理完成时间'</span>)</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">__str__</span><span class="params">(self)</span>:</span></span><br><span class="line">        <span class="keyword">return</span> self.title</span><br><span class="line"></span><br><span class="line">    <span class="class"><span class="keyword">class</span> <span class="title">Meta</span>:</span></span><br><span class="line">        verbose_name = <span class="string">'工单'</span></span><br><span class="line">        ordering = [<span class="string">'-complete_time'</span>]</span><br></pre></td></tr></table></figure>

<p>申请工单后端的逻辑：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> json</span><br><span class="line"></span><br><span class="line"><span class="keyword">from</span> django.shortcuts <span class="keyword">import</span> render</span><br><span class="line"><span class="keyword">from</span> django.forms <span class="keyword">import</span> model_to_dict</span><br><span class="line"><span class="comment"># Create your views here.</span></span><br><span class="line"><span class="keyword">from</span> apps.common <span class="keyword">import</span> response</span><br><span class="line"><span class="keyword">from</span> django.views <span class="keyword">import</span> View</span><br><span class="line"><span class="keyword">from</span> apps.workorder <span class="keyword">import</span> models</span><br><span class="line"></span><br><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">HandleWorkOrder</span><span class="params">(View)</span>:</span></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">post</span><span class="params">(self, request)</span>:</span></span><br><span class="line">        data = json.loads(request.body)</span><br><span class="line">        print(data)</span><br><span class="line"></span><br><span class="line">        <span class="comment"># title = data.get('title')</span></span><br><span class="line">        <span class="comment"># type =  data.get('type')</span></span><br><span class="line">        <span class="comment"># order_contents = data.get("order_contents")</span></span><br><span class="line">        <span class="comment"># applicant = data.get("applicant")</span></span><br><span class="line">        <span class="comment"># assign_to = data.get("assign_to")</span></span><br><span class="line">        <span class="comment"># final_processor = data.get("final_processor")</span></span><br><span class="line">        <span class="comment"># status = data.get('status')</span></span><br><span class="line">        <span class="comment"># result_desc = data.get('result_desc')</span></span><br><span class="line">        print(<span class="string">'workorder'</span>, request.user)</span><br><span class="line">        data[<span class="string">'applicant'</span>] = request.user.employ_name</span><br><span class="line">        data[<span class="string">'status'</span>] = <span class="number">1</span></span><br><span class="line">        models.WorkOrder.objects.create(**data)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> response.HttpOKResponse(content=<span class="string">"添加成功"</span>)</span><br></pre></td></tr></table></figure>

<p>前端页面：</p>
<p>申请工单的页面：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">  &lt;div&gt;</span><br><span class="line">    &lt;template&gt;</span><br><span class="line">      &lt;Form ref=&quot;addorderform&quot; :model=&quot;addorderform&quot;  :label-width=&quot;80&quot;&gt;</span><br><span class="line">        &lt;FormItem label=&quot;工单类型&quot; prop=&quot;type&quot;&gt;</span><br><span class="line">          &lt;Select v-model=&quot;addorderform.type&quot; placeholder=&quot;请选择工单类型&quot;&gt;</span><br><span class="line">            &lt;Option v-for=&quot;item in typelist&quot; :value=&quot;item.id&quot;  &gt;&#123;&#123; item.value &#125;&#125;&lt;/Option&gt;</span><br><span class="line">          &lt;/Select&gt;</span><br><span class="line">        &lt;/FormItem&gt;</span><br><span class="line">        &lt;FormItem label=&quot;工单标题&quot; prop=&quot;title&quot;&gt;</span><br><span class="line">          &lt;Input type=&quot;text&quot; v-model=&quot;addorderform.title&quot;&gt;&lt;/Input&gt;</span><br><span class="line">        &lt;/FormItem&gt;</span><br><span class="line">        &lt;FormItem label=&quot;工单内容&quot; prop=&quot;order_contents&quot;&gt;</span><br><span class="line">          &lt;Input type=&quot;textarea&quot; v-model=&quot;addorderform.order_contents&quot; :autosize=&quot;&#123;minRows: 10,maxRows: 10&#125;&quot;&gt;&lt;/Input&gt;</span><br><span class="line">        &lt;/FormItem&gt;</span><br><span class="line">        &lt;FormItem label=&quot;指派给&quot; prop=&quot;assign_to&quot;&gt;</span><br><span class="line">          &lt;Select v-model=&quot;addorderform.assign_to&quot; placeholder=&quot;请选择工单处理人&quot;&gt;</span><br><span class="line">            &lt;Option v-for=&quot;item in salist&quot; :value=&quot;item.name&quot;  &gt;&#123;&#123; item.name &#125;&#125;&lt;/Option&gt;</span><br><span class="line">          &lt;/Select&gt;</span><br><span class="line">        &lt;/FormItem&gt;</span><br><span class="line">        &lt;FormItem&gt;</span><br><span class="line">          &lt;Button type=&quot;primary&quot; @click=&quot;handleApplySubmit(&apos;addorderform&apos;)&quot;&gt;申请&lt;/Button&gt;</span><br><span class="line">        &lt;/FormItem&gt;</span><br><span class="line">      &lt;/Form&gt;</span><br><span class="line">    &lt;/template&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">    // import &#123; getSaMembers &#125; from &apos;@/api/users/group&apos;</span><br><span class="line">    import &#123; addWorkOrder &#125; from &apos;@/api/workorder/workorder&apos;</span><br><span class="line">    export default &#123;</span><br><span class="line">        name: &quot;addorder&quot;,</span><br><span class="line">        data () &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                addorderform: &#123;</span><br><span class="line">                    type: &apos;&apos;,</span><br><span class="line">                    title: &apos;&apos;,</span><br><span class="line">                    order_contents: &apos;&apos;,</span><br><span class="line">                    assign_to: &apos;&apos;,</span><br><span class="line">                &#125;,</span><br><span class="line">                typelist:[&#123;id:0, value:&apos;数据库&apos;&#125;, &#123;id:1, value:&apos;WEB服务&apos;&#125;, &#123;id:2, value:&apos;计划任务&apos;&#125;, &#123;id:3, value:&apos;配置文件&apos;&#125;,&#123;id:4, value:&apos;其他&apos;&#125;],</span><br><span class="line">                salist:[&#123;id:1, name:&apos;zekai&apos;&#125;, &#123;id:2, name:&apos;pounds&apos;&#125;],</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods:&#123;</span><br><span class="line">            // getSaList() &#123;</span><br><span class="line">            //     getSaMembers(3).then(res =&gt; &#123;</span><br><span class="line">            //         this.salist =  res.data.members</span><br><span class="line">            //     &#125;)</span><br><span class="line">            // &#125;,</span><br><span class="line">            handleApplySubmit(name) &#123;</span><br><span class="line">                let info = this.addorderform</span><br><span class="line">                console.log(info)</span><br><span class="line">                addWorkOrder(info).then(res=&gt;&#123;</span><br><span class="line">                    console.log(res)</span><br><span class="line">                    this.$Message.success(&apos;Success!&apos;);</span><br><span class="line"></span><br><span class="line">                    this.$router.push(&#123;</span><br><span class="line">                        name: &apos;handleorder&apos;</span><br><span class="line">                    &#125;)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        created() &#123;</span><br><span class="line">          // this.getSaList()</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>

<p>工单列表的后端逻辑：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">get</span><span class="params">(self, request)</span>:</span></span><br><span class="line">        status = request.GET.get(<span class="string">'status'</span>)</span><br><span class="line">        <span class="comment"># print(status, type(status))</span></span><br><span class="line"></span><br><span class="line">        user = request.user.employ_name</span><br><span class="line">        orderlist = models.WorkOrder.objects.filter(status__in=status, applicant=user).all()</span><br><span class="line"></span><br><span class="line">        <span class="comment"># res = [(model_to_dict(obj)) for obj in orderlist]</span></span><br><span class="line">        res = []</span><br><span class="line">        <span class="keyword">for</span> obj <span class="keyword">in</span> orderlist:</span><br><span class="line">            <span class="keyword">for</span> info <span class="keyword">in</span> models.WorkOrder.work_type:</span><br><span class="line">                <span class="keyword">if</span> info[<span class="number">0</span>] == obj.type:</span><br><span class="line">                    typename = info[<span class="number">1</span>]</span><br><span class="line">                    obj.type = typename</span><br><span class="line"></span><br><span class="line">            <span class="keyword">for</span> s <span class="keyword">in</span> models.WorkOrder.status_type:</span><br><span class="line">                <span class="keyword">if</span> s[<span class="number">0</span>] == obj.status:</span><br><span class="line">                    obj.status = &#123;</span><br><span class="line">                        <span class="string">"id"</span> : s[<span class="number">0</span>],</span><br><span class="line">                        <span class="string">"name"</span>: s[<span class="number">1</span>]</span><br><span class="line">                    &#125;</span><br><span class="line"></span><br><span class="line">            ret = model_to_dict(obj)</span><br><span class="line">            ret[<span class="string">'apply_time'</span>] = obj.apply_time.strftime(<span class="string">"%Y-%m-%d %H:%M:%S"</span>)</span><br><span class="line">            ret[<span class="string">'complete_time'</span>] = obj.complete_time.strftime(<span class="string">"%Y-%m-%d %H:%M:%S"</span>)</span><br><span class="line">            res.append(ret)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> response.HttpOKResponse(content=res)</span><br></pre></td></tr></table></figure>

<p>orderlist的显示页面：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">  &lt;div&gt;</span><br><span class="line">    &lt;Table border :columns=&quot;columns12&quot; :data=&quot;orderlist&quot; &gt;</span><br><span class="line"></span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;title&quot;&gt;</span><br><span class="line">        &lt;strong&gt;&#123;&#123; row.title &#125;&#125;&lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line"></span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;type&quot;&gt;</span><br><span class="line">        &lt;Tag color=&quot;cyan&quot;&gt;&#123;&#123; row.type &#125;&#125;&lt;/Tag&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line"></span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;status&quot;&gt;</span><br><span class="line">        &lt;strong&gt;</span><br><span class="line">          &lt;div v-if=&quot;row.status.id == 0&quot;&gt;</span><br><span class="line">            &lt;Tag color=&quot;green&quot;&gt; &#123;&#123; row.status.name &#125;&#125; &lt;/Tag&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">          &lt;div v-else-if=&quot;row.status.id == 1&quot;&gt;</span><br><span class="line">            &lt;Tag color=&quot;warning&quot;&gt;&#123;&#123; row.status.name &#125;&#125;&lt;/Tag&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">        &lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line"></span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;applicant&quot;&gt;</span><br><span class="line">        &lt;strong&gt;&#123;&#123; row.applicant &#125;&#125;&lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line"></span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row, index &#125;&quot; slot=&quot;action&quot;&gt;</span><br><span class="line"></span><br><span class="line">        &lt;div&gt;</span><br><span class="line">          &lt;Button type=&quot;primary&quot; size=&quot;small&quot; style=&quot;margin-right: 5px&quot; @click=&quot;handleSave(row, index)&quot;&gt;处理&lt;/Button&gt;</span><br><span class="line">          &lt;Button type=&quot;warning&quot; size=&quot;small&quot; @click=&quot;rejectorder(row, index)&quot;&gt;驳回&lt;/Button&gt;</span><br><span class="line">        &lt;/div&gt;</span><br><span class="line"></span><br><span class="line">        &lt;Modal v-model=&quot;updateworkordermodal&quot; title=&quot;处理工单&quot; @on-ok=&quot;handleupdateSubmit(index)&quot; @on-cancel=&quot;handleReset(index)&quot;&gt;</span><br><span class="line">          &lt;template&gt;</span><br><span class="line">            &lt;Form ref=&quot;updateworkorder&quot; :model=&quot;updateworkorder&quot;  :label-width=&quot;80&quot;&gt;</span><br><span class="line">              &lt;FormItem label=&quot;工单名称&quot; prop=&quot;title&quot;&gt;</span><br><span class="line">                &lt;Input type=&quot;text&quot; v-model=&quot;updateworkorder.title&quot; readonly&gt;&lt;/Input&gt;</span><br><span class="line">              &lt;/FormItem&gt;</span><br><span class="line"></span><br><span class="line">              &lt;FormItem label=&quot;工单内容&quot; prop=&quot;order_contents&quot;&gt;</span><br><span class="line">                &lt;Input type=&quot;textarea&quot; v-model=&quot;updateworkorder.order_contents&quot; readonly&gt;&lt;/Input&gt;</span><br><span class="line">              &lt;/FormItem&gt;</span><br><span class="line"></span><br><span class="line">              &lt;FormItem label=&quot;处理意见&quot; prop=&quot;result_desc&quot;&gt;</span><br><span class="line">                &lt;Input type=&quot;textarea&quot; v-model=&quot;updateworkorder.result_desc&quot;&gt;&lt;/Input&gt;</span><br><span class="line">              &lt;/FormItem&gt;</span><br><span class="line">            &lt;/Form&gt;</span><br><span class="line">          &lt;/template&gt;</span><br><span class="line">        &lt;/Modal&gt;</span><br><span class="line"></span><br><span class="line">&lt;!--        &lt;Button type=&quot;primary&quot; size=&quot;small&quot; style=&quot;margin-right: 5px&quot; @click=&quot;show(index)&quot;&gt;处理&lt;/Button&gt;--&gt;</span><br><span class="line"></span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">    &lt;/Table&gt;</span><br><span class="line">    &lt;div style=&quot;margin-top: 10px&quot;&gt;</span><br><span class="line">      &lt;template&gt;</span><br><span class="line">        &lt;Page :total=&quot;total&quot;   @on-change=&quot;changepage&quot; /&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line"></span><br><span class="line">&lt;/template&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">    import &#123; getorders,updateStatus &#125; from &apos;@/api/workorder/workorder&apos;</span><br><span class="line">    export default &#123;</span><br><span class="line">        data () &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                columns12: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单标题&apos;,</span><br><span class="line">                        slot: &apos;title&apos;</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单内容&apos;,</span><br><span class="line">                        key: &apos;order_contents&apos;,</span><br><span class="line">                        width: 300,</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单类型&apos;,</span><br><span class="line">                        slot: &apos;type&apos;,</span><br><span class="line">                        width: 110</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单状态&apos;,</span><br><span class="line">                        slot: &apos;status&apos;,</span><br><span class="line">                        width:100</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;申请人&apos;,</span><br><span class="line">                        slot: &apos;applicant&apos;,</span><br><span class="line">                        width:105</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;申请时间&apos;,</span><br><span class="line">                        key: &apos;apply_time&apos;</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;操作&apos;,</span><br><span class="line">                        slot: &apos;action&apos;,</span><br><span class="line">                        width: 150,</span><br><span class="line">                        align: &apos;center&apos;</span><br><span class="line">                    &#125;</span><br><span class="line">                ],</span><br><span class="line">                orderlist: [],</span><br><span class="line">                params:&#123;</span><br><span class="line">                    page:1,</span><br><span class="line">                    page_size:10,</span><br><span class="line">                    status:1</span><br><span class="line">                &#125;,</span><br><span class="line">                total:0,</span><br><span class="line">                editIndex: -1,  // 当前聚焦的输入框的行数</span><br><span class="line">                updateworkordermodal:false,</span><br><span class="line">                updateworkorder:&#123;</span><br><span class="line">                    title:&apos;&apos;,</span><br><span class="line">                    order_contents:&apos;&apos;,</span><br><span class="line">                    result_desc:&apos;&apos;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods: &#123;</span><br><span class="line"></span><br><span class="line">            getorderlist(params)&#123;</span><br><span class="line">                getorders(params).then(res=&gt;&#123;</span><br><span class="line">                    console.log(res);</span><br><span class="line"></span><br><span class="line">                    this.orderlist = res.data.data;</span><br><span class="line">                    this.total = res.data.count</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            changepage (index) &#123;</span><br><span class="line">                console.log(index)</span><br><span class="line">                this.params[&apos;page&apos;] = index</span><br><span class="line">                this.getorderlist(this.params)</span><br><span class="line">            &#125;,</span><br><span class="line">            handleSave (row, index) &#123;</span><br><span class="line">                this.updateworkordermodal = true</span><br><span class="line">                this.updateworkorder = row</span><br><span class="line">            &#125;,</span><br><span class="line">            handleupdateSubmit(index)&#123;</span><br><span class="line">                let row = this.updateworkorder</span><br><span class="line">                console.log(row)</span><br><span class="line"></span><br><span class="line">                delete row[&apos;_index&apos;]</span><br><span class="line">                delete row[&apos;_rowKey&apos;]</span><br><span class="line">                let info = Object</span><br><span class="line">                info = &#123; &apos;status&apos;:2, &apos;result_desc&apos;:row[&apos;result_desc&apos;], &apos;id&apos;:row[&apos;id&apos;]&#125;</span><br><span class="line">                updateStatus(row,info).then(res =&gt; &#123;</span><br><span class="line">                    this.getorderlist(this.params)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            rejectorder(row, index)&#123;</span><br><span class="line">                let info = Object</span><br><span class="line">                info = &#123; &apos;status&apos;:3 &#125;</span><br><span class="line">                updateStatus(row, info).then(res =&gt; &#123;</span><br><span class="line">                    this.getorderlist(this.params)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            handleReset()&#123;</span><br><span class="line"></span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        created() &#123;</span><br><span class="line">            this.getorderlist(this.params)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>

<p>工单状态的转换：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">patch</span><span class="params">(self, request)</span>:</span></span><br><span class="line"></span><br><span class="line">    data = json.loads(request.body)</span><br><span class="line">    id = data.pop(<span class="string">'id'</span>)</span><br><span class="line"></span><br><span class="line">    <span class="keyword">import</span> datetime</span><br><span class="line">    data[<span class="string">'complete_time'</span>] = datetime.datetime.now().strftime(<span class="string">"%Y-%m-%d %H:%I:%S"</span>)</span><br><span class="line">    models.WorkOrder.objects.filter(id=id).update(**data)</span><br><span class="line">    <span class="keyword">return</span> response.HttpOKResponse(content=<span class="string">'okok'</span>)</span><br></pre></td></tr></table></figure>

<p>工单历史的前端页面：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">  &lt;div&gt;</span><br><span class="line">    &lt;Table border :columns=&quot;columns12&quot; :data=&quot;orderhistory&quot;&gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;title&quot;&gt;</span><br><span class="line">        &lt;strong&gt;&#123;&#123; row.title &#125;&#125;&lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;type&quot;&gt;</span><br><span class="line">        &lt;Tag color=&quot;cyan&quot;&gt;&#123;&#123; row.type.name &#125;&#125;&lt;/Tag&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;status&quot;&gt;</span><br><span class="line">        &lt;strong&gt;</span><br><span class="line">          &lt;div v-if=&quot;row.status.id == 3&quot;&gt;</span><br><span class="line">            &lt;Tag color=&quot;red&quot;&gt;&#123;&#123; row.status.name &#125;&#125;&lt;/Tag&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line">          &lt;div v-else=&quot;row.status.id == 2&quot;&gt;</span><br><span class="line">            &lt;Tag color=&quot;success&quot;&gt;&#123;&#123; row.status.name&#125;&#125;&lt;/Tag&gt;</span><br><span class="line">          &lt;/div&gt;</span><br><span class="line"></span><br><span class="line">        &lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">      &lt;template slot-scope=&quot;&#123; row &#125;&quot; slot=&quot;applicant&quot;&gt;</span><br><span class="line">        &lt;strong&gt;&#123;&#123; row.applicant.name &#125;&#125;&lt;/strong&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line"></span><br><span class="line">    &lt;/Table&gt;</span><br><span class="line">    &lt;div style=&quot;margin-top: 10px&quot;&gt;</span><br><span class="line">      &lt;template&gt;</span><br><span class="line">        &lt;Page :total=&quot;total&quot;   @on-change=&quot;changepage&quot; /&gt;</span><br><span class="line">      &lt;/template&gt;</span><br><span class="line">    &lt;/div&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line"></span><br><span class="line">&lt;/template&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">    import &#123; getorders,updateStatus &#125; from &apos;@/api/workorder/workorder&apos;</span><br><span class="line">    export default &#123;</span><br><span class="line">        data () &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                columns12: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单标题&apos;,</span><br><span class="line">                        slot: &apos;title&apos;</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单内容&apos;,</span><br><span class="line">                        key: &apos;order_contents&apos;,</span><br><span class="line">                        width: 300,</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单类型&apos;,</span><br><span class="line">                        slot: &apos;type&apos;,</span><br><span class="line">                        width:110</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;工单状态&apos;,</span><br><span class="line">                        slot: &apos;status&apos;,</span><br><span class="line">                        width:100</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;申请人&apos;,</span><br><span class="line">                        slot: &apos;applicant&apos;,</span><br><span class="line">                        width:105</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;处理意见&apos;,</span><br><span class="line">                        key: &apos;result_desc&apos;,</span><br><span class="line">                        width:105</span><br><span class="line">                    &#125;,</span><br><span class="line">                    &#123;</span><br><span class="line">                        title: &apos;完成时间&apos;,</span><br><span class="line">                        key: &apos;complete_time&apos;</span><br><span class="line">                    &#125;</span><br><span class="line">                ],</span><br><span class="line">                orderhistory: [],</span><br><span class="line">                params:&#123;</span><br><span class="line">                    page:1,</span><br><span class="line">                    page_size:10,</span><br><span class="line">                    status:2</span><br><span class="line">                &#125;,</span><br><span class="line">                total:0</span><br><span class="line"></span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods: &#123;</span><br><span class="line"></span><br><span class="line">            getorderlist(params)&#123;</span><br><span class="line">                getorders(params).then(res=&gt;&#123;</span><br><span class="line">                    this.orderhistory = res.data.results</span><br><span class="line">                    this.total = res.data.count</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            changepage (index) &#123;</span><br><span class="line">                this.params[&apos;page&apos;] = index</span><br><span class="line">                this.getorderlist(this.params)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        created() &#123;</span><br><span class="line">            this.getorderlist(this.params)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>

<p>测试的git: <a href="https://git.carzone365.com/devops/test1" target="_blank" rel="noopener">https://git.carzone365.com/devops/test1</a></p>

    </div>

  </article>
  <div class="toc-container">
    

  </div>
</div>
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=5sr5du46f27&amp;m=0&amp;c=ff0000&amp;cr1=ffffff&amp;f=arial&amp;l=33" async="async"></script>
<div class="copyright">
    <span>本作品采用</span>
    <a href="https://creativecommons.org/licenses/by/4.0/">知识共享署名 4.0 国际许可协议</a>
    <span>进行许可。 转载时请注明原文链接。</span>
</div>


  
    <div class="post-nav" style="margin-left:-168px;">
      <div class="post-nav-item post-nav-next">
        
          <span>〈 </span>
          <a href="/2020/11/09/五分钟带你了解JWT/" rel="next" title="五分钟带你了解JWT">
          五分钟带你了解JWT
          </a>
        
      </div>
  
      <div class="post-nav-item post-nav-prev">
          
          <a href="/2020/12/09/鸡毛蒜皮定律/" rel="prev" title="鸡毛蒜皮定律">
            鸡毛蒜皮定律
          </a>
          <span>〉</span>
        
      </div>
    </div>
  


	
	<div style="width:109%; margin-left:-144px" id="lv-container" data-id="city" data-uid="MTAyMC80OTg5NS8yNjM4Ng==">
	<script type="text/javascript">
   	   (function(d, s) {
       		var j, e = d.getElementsByTagName(s)[0];

       		if (typeof LivereTower === 'function') { return; }

       		j = d.createElement(s);
       		j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
       		j.async = true;

       		e.parentNode.insertBefore(j, e);
   	   })(document, 'script');
	</script>
	<noscript> 为正常使用来必力评论功能请激活JavaScript</noscript>
        </div>
	



    </div>

    

  </div>
  <footer class="footer text-center">
    <div id="bottom-inner">
        <a class="bottom-item" href target="_blank">GitHub</a> |
        <a class="bottom-item" href>友情链接</a> |
        <a class="bottom-item" href="https://hexo.io" target="_blank">Powered by hexo</a> |
        <a class="bottom-item" href="https://github.com/fooying/hexo-theme-xoxo-plus" target="_blank">Theme xoxo-plus</a> |
        <a class="bottom-item" href="/atom.xml">订阅</a>
    </div>
</footer>

  

<script>
  (function(window, document, undefined) {

    var timer = null;

    function returnTop() {
      cancelAnimationFrame(timer);
      timer = requestAnimationFrame(function fn() {
        var oTop = document.body.scrollTop || document.documentElement.scrollTop;
        if (oTop > 0) {
          document.body.scrollTop = document.documentElement.scrollTop = oTop - 50;
          timer = requestAnimationFrame(fn);
        } else {
          cancelAnimationFrame(timer);
        }
      });
    }

    var hearts = [];
    window.requestAnimationFrame = (function() {
      return window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.oRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback) {
          setTimeout(callback, 1000 / 60);
        }
    })();
    init();

    function init() {
      css(".heart{z-index:9999;width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: absolute;}.heart:after{top: -5px;}.heart:before{left: -5px;}");
      attachEvent();
      gameloop();
      addMenuEvent();
    }

    function gameloop() {
      for (var i = 0; i < hearts.length; i++) {
        if (hearts[i].alpha <= 0) {
          document.body.removeChild(hearts[i].el);
          hearts.splice(i, 1);
          continue;
        }
        hearts[i].y--;
        hearts[i].scale += 0.004;
        hearts[i].alpha -= 0.013;
        hearts[i].el.style.cssText = "left:" + hearts[i].x + "px;top:" + hearts[i].y + "px;opacity:" + hearts[i].alpha + ";transform:scale(" + hearts[i].scale + "," + hearts[i].scale + ") rotate(45deg);background:" + hearts[i].color;
      }
      requestAnimationFrame(gameloop);
    }

    /**
     * 给logo设置点击事件
     * 
     * - 回到顶部
     * - 出现爱心
     */
    function attachEvent() {
      var old = typeof window.onclick === "function" && window.onclick;
      var logo = document.getElementById("logo");
      if (logo) {
        logo.onclick = function(event) {
          returnTop();
          old && old();
          createHeart(event);
        }
      }
      
    }

    function createHeart(event) {
      var d = document.createElement("div");
      d.className = "heart";
      hearts.push({
        el: d,
        x: event.clientX - 5,
        y: event.clientY - 5,
        scale: 1,
        alpha: 1,
        color: randomColor()
      });
      document.body.appendChild(d);
    }

    function css(css) {
      var style = document.createElement("style");
      style.type = "text/css";
      try {
        style.appendChild(document.createTextNode(css));
      } catch (ex) {
        style.styleSheet.cssText = css;
      }
      document.getElementsByTagName('head')[0].appendChild(style);
    }

    function randomColor() {
      // return "rgb(" + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + ")";
      return "#F44336";
    }

    function addMenuEvent() {
      var menu = document.getElementById('menu-main-post');
      if (menu) {
        var toc = document.getElementById('toc');
        if (toc) {
          menu.onclick = function() {
            if (toc) {
              if (toc.style.display == 'block') {
                toc.style.display = 'none';
              } else {
                toc.style.display = 'block';
              }
            }
          };
        } else {
          menu.style.display = 'none';
        }
      }
    }

  })(window, document);
</script>

  



  

</body>
</html>
